package ro.cityprojects.adminloc.service;

import ro.cityprojects.adminloc.entities.BaseEntity;
import ro.cityprojects.adminloc.exceptions.EntityNotFoundException;
import ro.cityprojects.adminloc.exceptions.ValidationException;

import java.io.Serializable;

/**
 * Interface used to specify the operations common for all types of entities
 *
 * @author bogdan.solga
 *
 * Date: 14.06.2013, time: 14:27
 */
public interface ServiceOperations<PK extends Serializable, Entity extends BaseEntity> {

    public String[] getDefaultFields();

    // Create operations
    public void save(Entity entity) throws ValidationException;

    // Read operations
    public String get(PK primaryKey, String includedFields) throws EntityNotFoundException;

    public String getAll(String filterName, String filterValue, String includedFields);

    // Update operations
    public void update(Entity entity, PK primaryKey) throws ValidationException;

    // Delete operations
    public void delete(PK primaryKey) throws EntityNotFoundException;

    public void checkExisting(Entity entity) throws ValidationException;

    public String getMetadata();
}
